var app = getApp();
// pages/home/components/Classification/Classification.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    "basi":{type:Object}
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

    attached() {
        app.func.getPromise('/list/shortcut')
            .then(([code, res]) => {
                this.setData({brand: res.data});
            });
    },

    /**
   * 组件的方法列表
   */
  methods: {
    brandsku: function (e) {
			let item = e.currentTarget.dataset.item;
			console.log(item)
			switch (item[`link_type`]){
				case 0:
					let id = item[`category_id`];
					// wx.setStorage({key:"ca【【【【tegory_id", id})旧
					wx.setStorageSync('category_id', id)
					let extConfig = wx.getExtConfigSync? wx.getExtConfigSync(): {} ;
					if(extConfig.category = null || extConfig.category == 0) {
						wx.navigateTo({
							url: '/pages/index/categorysku/categorysku',
						})
					} else {
						wx.navigateTo({
							url: '/pages/index/newcategory/newcategory?id=' + id,
						})
					}
					break;
				case 1:
					wx.navigateTo({
						url:'/pages/index/brandsku/brandsku?id=' + item['topic_id']
					})
					break;
				case 2:
					break;
			}
		},
  }
})
